<!-- 用户管理 -->
<template>
    <div class="page-box h100 display-flex czbj">
      <dxtable
        :dataJson="dataJson"
        :portUrl="portUrl"
        :formJson="formJson"
        :extra="{accountType:2}"
        imgkuTitle="监控前端头像"
        :qx="qx"
      ></dxtable>
    </div>
  </template>
   <script lang='ts' setup>
  import { leixing } from "../../util/config";
  import dxtable from "../../components/util/dxtable.vue";
  import { dxget } from "../../util/index";
  import { h, ref, reactive } from "vue";
  let qxList = ref([]);
  let dataJson = [
    {
      title: "头像",
      key: "headPortrait",
      width:100,
      type: "img", //类型
    },
    {
      title: "账号",
      key: "userNmae",
      search: true, // 是否在搜索栏展示
    },
    {
      title: "昵称",
      key: "userNickname",
      search: true, // 是否在搜索栏展示
    },
    {
      title: "角色名称",
      key: "CharacterNameCode",
      render(row) {
        try {
          let ql = qxList.value.filter((a) => a.id == row.CharacterNameCode);
          return ql[0].name;
        } catch (e) {
          return "";
        }
      },
    },
    {
      title: "登录ip",
      key: "ip"
    },
  
    {
      title: "创建时间",
      key: "addTime",
    },
  ];
  const qx = {
    DeletePermissionID: "jkusermsgdel", //删除
    EditPermissionIdentifier: "jkusermsgbj", // 编辑
    NewPermissionIdentifier: "jkusermsgxz", // 新建
    ViewPermissionID: "jkusermsgck", // 查看
  };
  // const portUrl = "dxgjAdmin/administrator?CharacterNameCode=" + leixing;
  const portUrl = "dxgjAdmin/administrator?accountType=2";
  let formJson = reactive([
    {
      title: "管理员名",
      type: "input",
      key: "userNmae",
      required: true, // 是否为必填
    },
    {
      title: "管理员密码",
      type: "password",
      key: "userPassword",
      required: true, // 是否为必填
    },
    {
      title: "管理昵称",
      key: "userNickname",
      type: "input",
      required: true, // 是否为必填
    },
    {
      title: "角色名称",
      type: "select",
      key: "CharacterNameCode",
      required: true, // 是否为必填
      options: [],
    },
    {
      title: "头像",
      key: "headPortrait",
      type: "img", //类型
      required: true, // 是否为必填
    },
  ]);
  let optionsSele = [];
  const getSelect = async () => {
    let { data }: any = await dxget("jk/jkrolemanagementList");
    console.log(data);
    data.map((a) => {
      optionsSele.push({
        label: a.name,
        value: a.id,
      });
    });
    formJson[3].options = optionsSele;
    qxList.value = data;
  };
  getSelect();
  </script>
   <style scoped>
  </style>